package org.duiduo.utils;

import org.apache.commons.lang.RandomStringUtils;

/**
 * 生成相关工具类
 *
 * @author liangze
 * @date 2021/9/23 10:44
 */
public class RandomGenerateUtil {

    private final static char[] chr = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
            'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};

    private final static char[] chr_number = {'1', '2', '3', '4', '5', '6', '7', '8', '9', '0'};

    public static String random(int randomLength){
        return RandomStringUtils.random(randomLength, chr);
    }

    public static String randomNumber(int randomLength){
        return RandomStringUtils.random(randomLength, chr_number);
    }

    public static void main(String[] args) {
        System.out.println(random(10));
    }
}
